home *** CD-ROM | disk | FTP | other *** search
/ CICA 1993 April / CICA MS Windows - April 1993.iso / unzipped / programr / listings / ptv2n5 / int10.pas < prev    next >
Pascal/Delphi Source File  |  1991-11-01  |  1KB  |  41 lines

  1. {$M 1024,0,0}
  2. {$S-,R-}
  3. program Int10;
  4.   {-Simple program to illustrate ISRs using BASM}
  5. uses Dos;
  6.  
  7. const
  8.   VesaCallMade : Boolean = False;
  9.  
  10. var
  11.   OldInt10Ptr : ^Pointer;
  12.  
  13. procedure Int10Handler; Near; Assembler;
  14. asm
  15.   jmp     @PastData
  16. @OldInt10: dd 0
  17. @PastData:
  18.   cmp     ax,4F00h                 {is this a VESA present call}
  19.   je      @VesaCall
  20. @DoOldInt:
  21.   jmp     dword ptr cs:@OldInt10   {call original int 10h handler}
  22. @VesaCall:
  23.   push    ds
  24.   push    ax
  25.   mov     ax,SEG @DATA             {set up TP's data segment}
  26.   mov     ds,ax
  27.   mov     VesaCallMade,1           {set our global boolean to True}
  28.   pop     ax
  29.   pop     ds
  30.   jmp     @DoOldInt                {we're outahere}
  31. end;
  32.  
  33. begin
  34.   OldInt10Ptr := @Int10Handler;
  35.   Inc(Word(OldInt10Ptr), 2);    {point to @OldInt10 in Int10Handler}
  36.   GetIntVec($10, OldInt10Ptr^);    {store old int in code segment}
  37.   SetIntVec($10, @Int10Handler);   {set int 10h to our ISR}
  38.   SwapVectors;                     {undo TP's RTL ISRs}
  39.   Keep(0);                         {go resident}
  40. end.
  41.